<?php

namespace App\Model;

use App\Model\Traits\Common;
use App\User;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
use Spatie\Activitylog\Traits\LogsActivity;

class Article extends Model
{
    use Common;
    use LogsActivity;
    use Searchable;
    protected static $logFillable=true;
    protected static $recordEvents=['saved','updated'];
    protected static $logName='article';
//    protected $guarded=[];
    protected $fillable = [
        'title', 'content','zan_num'

    ];


    public function getLink($param){
        return route('home.article.show',$this).$param;
    }
    public function getMarkdownAttribute($key){

       $parsedown= new \Parsedown();
       return $parsedown->text($this['content']);
    }
    public function getModel(){
return $this->morphTo('article');
    }

}
